const url = require('url');

var strUrl = 'http://www.demo.com:3000?a=123&b=456#admin';

// var obj = url.parse(strUrl);

var obj = {
    hostname: 'www.demo.com',
}

console.log(obj);

console.log(url.format(obj));
